|
|
|
|
|
|
|
Resolving Synchronization Conflicts |
|
|
|
|
|
|
|
|
Data conflicts are quite common among members of a replica set. They can occur when the same record gets changed in different replicas in between synchronizations. This means that two different users might see two different values for the record. How does the Microsoft Jet engine know which value should be used? Better yet, how does it know which value to use and distribute throughout the entire replica set? |
|
|
|
|
|
|
|
|
The logic that the Microsoft Jet engine uses to resolve synchronization conflicts is simple and consistent. The replica set member that changes the record the greatest number of times wins the conflict. If this number is equal for all the replica members being synchronized, the Microsoft Jet engine selects the record from the table with the lowest ReplicaID. |
|
|
|
|
|
|
|
|
As you remember, the s_Lineage field stores the number of changes to a record. This is the field that the Microsoft Jet engine examines to determine which replica set member wins the conflict. |
|
|
|
|
|
|
|
|
Load COPY.MDB into Visdata and open the Authors table. Change the first record by changing the name of the Author in the first record from "Smith, John" to "Smith, Copy." Now open the REPLMAST.MDB database in Visdata, load the Authors table, and change the Name field of the first record to "Smith, Curtis." Now save the record and close the table. Reopen the table and change the DOB (Date of Birth) field to 9/2/64. Save the record and close the table. |
|
|
|
|
|
|
|
|
You have now changed the first record of the Authors table of COPY.MDB database once, and the same record in the REPLMAST.MDB database twice. In a synchronization, which change do you think prevails? |
|
|
|
|
|
|
|
|
To find out, close Visdata and load the REPLDEMO.VBP project. Run the project and click the Synchronize button. When you are informed that the synchronization is complete, close the project by pressing Exit. |
|
|
|
|
|
|
|
|
Return to Visdata and load COPY.MDB. Open the Authors table and notice that the first record is updated based upon the values that were entered into the REPLMAST.MDB database. That is to say, the Microsoft Jet engine knows that this record changed more times in the REPLMAST.MDB files than in COPY.MDB, and therefore chooses that record as the one to use in the synchronization. |
|
|
|
|
|
|
|
|
But what happened to the change made in the COPY.MDB file? To find out, close the Authors table, and you notice that a new table was added to this database during the synchronization process, the Authors_Conflict table. Open this table and you find a record with the single change. Your screen should look similar to Figure 20.16. |
|
|
|
|
|
|
|
|
Open the REPLMAST.MDB database in Visdata. Notice in the Database window that the Authors_Conflict table does not exist. The error table created by a synchronization conflict is stored only in the table that lost the conflict. Open the Authors table, and you should see that both changes made to the first record were preserved. |
|
|
|
|
|